package org.keyyond.ms.commonservice.dao;

import java.util.List;
import java.util.UUID;

import org.keyyond.ms.commonservice.mapper.SDBDRoleMapper;
import org.keyyond.ms.commonservice.model.SDBDRole;
import org.keyyond.ms.core.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.github.pagehelper.Page;

@Component
public class SDBDRoleDao {
	
	@Autowired
	private SDBDRoleMapper roleMapper;

	public List<SDBDRole> selectRolesByRoleIds(SDBDRole role) {
		// TODO Auto-generated method stub
		return roleMapper.selectRolesByRoleIds(role);
	}

	public List<SDBDRole> selectAll() {
		// TODO Auto-generated method stub
		return roleMapper.selectAll();
	}

	public int getAllFDFBRolesCount(SDBDRole role) {
		// TODO Auto-generated method stub
		return roleMapper.getAllFDFBRolesCount(role);
	}

	public Page<SDBDRole> selectAllByPage(SDBDRole role) {
		// TODO Auto-generated method stub
		return roleMapper.selectAllByPage(role);
	}

	public int insert(SDBDRole role) {
		role.setSeqno(UUID.randomUUID().toString());
		role.setCreateon(DateUtil.getTimestamp());
		role.setModifyon(DateUtil.getTimestamp());
		return roleMapper.insert(role);
	}

	public int deleteByPrimaryKey(String seqno) {
		// TODO Auto-generated method stub
		return roleMapper.deleteByPrimaryKey(seqno);
	}

	public int updateRoleDynamic(SDBDRole role) {
		// TODO Auto-generated method stub
		role.setNewMofifyon(DateUtil.getTimestamp());
		return roleMapper.updateByPrimaryKeySelective(role);
	}

}
